package com.example.demo;

import com.example.demo.service.Constants;
import com.example.demo.service.LoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

@Slf4j
@SpringBootApplication
public class DemoApplication {

    @Value("${gewe.url}")
    private String baseUrl;
    @Resource
    private LoginService loginService;

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

    @PostConstruct
    public void init() {
        log.info("项目启动完成！");

        Constants.baseUrl = baseUrl;
        log.info("设置baseUrl={}", baseUrl);

        loginService.setToken(false);
        loginService.setXueqiuToken();
        loginService.setAppId();
    }
}